<template>
	<view class="content_bg" :style="{width: windowWidth + 'px',height: windowHeight + 'px'}">
		<!-- <view>视频问诊</view> 客户端-->
		<cu-custom bgColor="bg-E96141" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">视频问诊</block>
		</cu-custom>
		
		<view class="content colum_flex" style="">
			<!-- icon -->
			<view class="colum_flex">
				<image src="../../static/icon_logo.png" mode="" style="width: 80px;height: 80px;"></image>
				<text style="color: #FFFFFF;margin-top: 40px;">视频问诊 呼叫医生</text>
			</view>
			<!-- 场景选择 -->
			<view class="colum_flex" style="margin-top: 100px;">
				<view style="display: flex;justify-content: center;">
					<view class="p-2 colum_flex" style="background-color: #FFFFFF;border-radius: 6px;"
						@click="goBack('p2p')" >
						<image src="../../static/icon_single.png" mode="" style="width: 60px;height: 60px;"></image>
						<text style="margin-top: 10px;">连线医生</text>
					</view>
				</view>
				<text style="color: #FFFFFF;margin-top: 40px;text-align: center;" >您的呼叫ID:
					{{$store.state.uid ? $store.state.uid : '未登录'}}</text>
			</view>
		</view>
	<!-- 	<uni-popup ref="popup" :mask-click="false"  type="top" style="margin-top: 90upx;z-index: 99999;" >
			<view> -->
				<!-- 视频结算清单 -->
	<!-- 			<submit-order  :zhifuInfo="zhifuInfo" ></submit-order>
			
			</view> -->
			<!-- <view @click="close" class="sub" style="flex: 1;font-size: 20upx;">关闭</view> -->
		<!-- </uni-popup> -->


	</view>
</template>
<script>
	import {	
		USER_IDENTITY,	
		DOCTOR_CLIENTID,		
		} from "@/common/util/constants"
	import uniPopup from '../../components/uni-popup/uni-popup.vue'
	import submitOrder from '../../components/submit-order.vue'	
	export default {
		components: {
			uniPopup,submitOrder
		},
		onLoad(options) {
			// 默认弹窗 客户端
			this.$store.dispatch('upDataPopubId', 'poPup');
			if (options.state === 'end' || options.state === 'abnormityEnd') {
				setTimeout(() => {
					this.$Utils.hintInfo(options.state === 'end' ? '通话已结束' : '通话异常', options.state === 'end' ?
						'success' : 'warn');
				}, 800)
			}
			this.flag=options.flag
			this.zhifuInfo.price=options.price
			this.zhifuInfo.ylbprice=options.ylbprice
			this.onSMSSend()
		},
	
		data() {
			return {
				windowWidth: 200,
				windowHeight: 200,
				doctorId:'',
				phoneNO:'',
				flag:'1',
				zhifuInfo:{
					'price':'30',
					'title':'视频问诊',
					'ylbprice':'10',
					'orderType': '5',
				},
				
			}
		},
		created() {
			// 默认弹窗
			this.$store.dispatch('upDataPopubId', 'poPup');
			let _this = this;
			uni.getSystemInfo({
				success: function(res) {
					_this.windowWidth = res.windowWidth;
					_this.windowHeight = res.windowHeight;
				}
			});
	
		},
	
		methods: {
			// 打开弹窗
			open(){				
				if(this.flag=='2'){
					console.log(this.flag)
					// this.$refs.popup.open()
				}					
			},		
			// 关闭弹窗
			close() {
				this.$refs.popup.close()
			},
			//给医生发送视频短信
			async aonSMSSend() {
				let smsParams = {};	
			    let that=this
				this.$http.get('/onlineservice/doctor/list').then(res=>{
					console.log(res.data.result+"kkkkkkkkkkkkkkkpppp")
					if(res.data.success){
						console.log(res.data.result[0].phone+"kkkkkkkkkkkkkkk")
						that.phoneNO=res.data.result[0].phone
						that.doctorId=res.data.result[0].clientId
						
						console.log(that.phoneNO+"666666666666666668888")
							console.log(that.doctorId+":that.doctorId")
						smsParams.smsmode="1";
						smsParams.mobile=res.data.result[0].phone;	
						this.$http.post("/sys/sms",smsParams).then(res=>{
						  if(res.data.success){
						  }else{
							this.smsCountDown = 0;
							// this.$tip.toast(res.data.message);
						  }
						});
					}
				})
				
				// smsParams.mobile=this.phoneNO;		
			    
			
			  },	
			// 跳转
			 goBack(url) {
				console.log("客户端是否已付款:"+this.flag)
				if(this.flag=='2'){
					console.log(this.flag)
					this.$refs.popup.open()
					// return false
				}	
				// console.log('885555555')
				console.log(this.doctorId+">>>>>>>>>>>>>>")
				if (this.$store.state.uid) {
					
					uni.navigateTo({
						url:url+"?doctorId="+this.doctorId,
						animationType: "slide-in-bottom",
						animationDuration: 300,
						success(res) {
							console.log("成功", res);
						},
						fail(res) {
							console.log("失败", res);
						}
					});
				} else {
					uni.showToast({
						title: '未登录',
						icon: "none",
						duration: 2000
					});
				}
			}
		}
	}
</script>
<style scoped>
	.m-2 {
		margin: 20px;
	}

	.p-2 {
		padding: 20px;
	}

	.content_bg {
		background: url(../../static/icon_back.png) no-repeat;
		background-size: cover;
		background-position: center;
		position: relative;
	}

	.content {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
	}

	.colum_flex {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
	}
</style>
